package com.woniu.springcrud.service.impl;

import com.woniu.springcrud.entity.Role;
import com.woniu.springcrud.entity.Role;
import com.woniu.springcrud.mapper.RoleMapper;
import com.woniu.springcrud.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author: 16327
 * @date: 2021/1/19 10:22
 * @description:
 */
@Service
public class RoleServiceImpl implements RoleService {
    @Autowired
    RoleMapper RoleMapper;
    @Override
    public List<Role> findAll() {
        List<Role> Roles = RoleMapper.selectByExample(null);
        return Roles;
    }

    @Override
    public int deleteRoleById(Integer id) {
        int i = RoleMapper.deleteByPrimaryKey(id);
        return i;
    }

    @Override
    public int updateRole(Role Role) {

        int i = RoleMapper.updateByPrimaryKey(Role);
        return i;
    }

    @Override
    public int insertRole(Role Role) {
        return RoleMapper.insert(Role);
    }
}
